﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinformTest
{
    public partial class RoleChoose : Form
    {
        public RoleChoose()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            String sql = "select id,name,password,dept_id,duty_id from system_users where loginid='" + textBox1.Text+"'";
            String[][] tmpdata=CommonLibrary.DB.DBExecuteUtil.querySqlArray(sql);
            if (tmpdata == null || textBox2.Text.Trim() != tmpdata[0][2])
            {
                MessageBox.Show("密码错误");
                return;
            }
            else 
            {
                GlobleVar.mySelf = new CommonLibrary.DataModel.Basic.UserEntity()
                {
                    id = int.Parse(tmpdata[0][0]),
                    name = tmpdata[0][1],
                    dept_id = int.Parse(tmpdata[0][3]),
                    duty_id = int.Parse(tmpdata[0][4])
                };
                new Default().ShowDialog();
            }
        }
    }
}
